package com.chen.controller;

import com.chen.entity.UserInfo;
import com.chen.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

@RestController
public class RestfulController {

    @PostMapping("/adds")
    public ResultVo addUser(@RequestBody UserInfo userInfo){
        System.out.println("新增用户信息："+userInfo);
        return new ResultVo(200,"新增用户成功",null);
    }

    @DeleteMapping("/delete/{id}")
    public String del(@PathVariable Integer id) {
        System.out.println("删除用户的ID："+id);
        return "删除成功！";
    }

    @PutMapping("/update")
    public String update(@RequestBody UserInfo userInfo){
        System.out.println(userInfo);
        System.out.println("修改成功");
        return "修改成功";
    }

    @PostMapping("/getInfo/{id}")
    public String get(@PathVariable Integer id){
        System.out.println("查询单个:"+id);
        return "查询单个";
    }

    @GetMapping("/getAll")
    public String all(){
        System.out.println("查询所有用户");
        return "查询所有";
    }
}
